package com.dongdongshop.controller;

import com.dongdongshop.data.Result;
import com.dongdongshop.service.TypeService;
import com.dongdongshop.vo.TypeVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("type")
public class TypeController {

    @Autowired
    private TypeService ts;

    @PostMapping("getAll")
    public Result getAll(@RequestBody TypeVO typeVO){
       List<TypeVO> list = ts.getAll(typeVO);
       return Result.OK().setData(list);
    }

    @PostMapping("add")
    public Result add(@RequestBody TypeVO typeVO) {
        ts.add(typeVO);
        return Result.OK();
    }
}
